<?php $this->regCss('iconfont/iconfont.css') ?>
<?php $this->regCss('mine.css') ?>
<?php $this->regCss('common.css') ?>
<style type="text/css">body{background:#fff!important;}</style>
<div style="background: #00b9ee;" class="header">
         <a href="javascript:history.go(-1)"> <i class="iconfont">&#xf0292;</i></a>
         充值
       </div>
<div class="container " style="padding:0;">
    <p class="selecthe">选择充值面额（元）</p>
    <?php $form = self::beginForm(['showLabel' => false, 'action' => url(['user/pay']), 'id' => 'payform']) ?>
    <div class="boxflex1 paystyle" style="padding: 10px 15px 0;">
        <div class="group_btn clearfloat">
            <div class="btn_re">
                <a class="btn_money on">4800</a>
            </div>
            <div class="btn_re btn_center">
                <a class="btn_money">3200</a>
            </div>
            <div class="btn_re btn_center">
                <a class="btn_money">2400</a>
            </div>
            <div class="btn_re">
                <a class="btn_money">1600</a>
            </div>
            <div class="btn_re">
                <a class="btn_money">1100</a>
            </div>
        </div>
        <div class="group_btn group clearfloat">
            <div class="btn_re">
                <a class="btn_money">500</a>
            </div>
            <div class="btn_re btn_center">
                <a class="btn_money">300</a>
            </div>
            <div class="btn_re btn_center">
                <a class="btn_money">100</a>
            </div>
      <!--       <div class="btn_re">
                <a class="btn_money">50</a>
            </div> -->
        </div>
        <input type="hidden" id="amount" name="amount" value="4800">
        <input type="hidden" id="type" name="type" value="1">
    </div>
    <div class="boxflex1">
        <div class="moneyhead">充值方式</div>
    </div>
    <div class="payType">
        <div class="boxflex1 paystyle checkImg1" data-type="1">
            <img src="/images/pay.png" style="width: 20px;">
            <span>网银快捷支付</span>
            <img src="/images/seleted.png" alt="" style="float:right;" class="check-payone checkPay" >
        </div>
    </div>
    <div class="recharge-btn" id="payBtn">立即充值</div>
    <div class="recharge-btn" style="margin-top: 10px;" id="payBtn_">官方充值</div>

    <?php self::endForm() ?>
    <div class="row">
        <!-- <div class="col-xs-12 text-center font_14 remain">跳转至微信安全支付网页，微信转账说明</div> -->
<!--         <div class="col-xs-12 text-center font_12">
            <font>注1：暂时只能使用借记卡充值</font>
            <br>
            <font>注2：为了管控资金风险，单日充值限额20000元</font>
        </div> -->
    </div>
</div>
<script>
$(function() {
    $('#type').val(1);
    $(".btn_money").click(function() {
        $(".on").removeClass("on");
        $(this).addClass("on");
        $('#amount').val($(this).html());
    });

    $('#payBtn').on('click', function(){
        if($('#type').val() == 3 ) {
            var str = prompt("请输入卡号","");
            if(!str) {
                return false;
            }else {
                $("#card").val(str);
            }
        }
        var amount = $('#amount').val();
        if(!amount || isNaN(amount) || amount <= 0){
            alert('金额输入不合法!');
            return false;
        }
        $("#payform").submit();
    });

    $('.payType .paystyle').on('click', function(){
        var type = $(this).data('type');
        $('.payType .paystyle').each(function(){
            if (type == $(this).data('type')) {
                $(this).find('.checkPay').attr({"src":"/images/seleted.png"});
            } else {
                $(this).find('.checkPay').attr({"src":"/images/notseleted.png"});
            }
        });
        $('#type').val(type);
    });
    $('#payBtn_').on('click', function(){
        layer.open({
            type: 1,
            title: '',
            zIndex: 19891020,
            area: '90%',
            offset: '10%',
            content: "<img src='/images/rengong-service.png' style='width: 100%;' />"
        });
    });
})
</script>
